import Vue from 'vue'
import App from './App.vue'
import router from './router'
import '@/assets/style/index.less'
import 'animate.css';
import '@/components/index'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import '@/lib/vantUI'
import WebSocketPlugin from '@/lib/websocket';
ElementUI.Select.computed.readonly = function () {
  const isIE = !this.$isServer && !Number.isNaN(Number(document.documentMode));
  return !(this.filterable || this.multiple || !isIE) && !this.visible;
};

Vue.use(ElementUI)
Vue.use(WebSocketPlugin, {
  // 这里可以传递WebSocket插件需要的配置选项
});
Vue.config.productionTip = false
new Vue({
  router,
  render: h => h(App),
  websocket: {
    onMessage(event) {
      // 处理接收到的消息
      console.log('Received message:', event.data);
    },
    onOpen() {
      // WebSocket连接打开时的处理
      console.log('WebSocket connected');
    },
    onClose() {
      // WebSocket连接关闭时的处理
      console.log('WebSocket disconnected');
    },
    onError(error) {
      // 处理WebSocket错误
      console.error('WebSocket error:', error);
    }
  }
}).$mount('#app')
